package cn.edu.dz.thread02;

public class MyThread1 implements  Runnable {
    private Thread th;

    @Override
    public void run() {
        for (int i = 0; i <10 ; i++) {
            System.out.println(i+"MyThread1");
            try {
                if(i==5){
                    th.join();
                }

                Thread.sleep(500);

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public Thread getTh() {
        return th;
    }

    public void setTh(Thread th) {
        this.th = th;
    }
}
